<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>产品添加</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<style>
		html{ padding: 10px}
	</style>
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote">编辑产品</blockquote>
<form class="layui-form" id="bd1">


	<div class="layui-form-item">
		<label class="layui-form-label">产品标题</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input newsName"  value="{$t.name}" name="name" placeholder="请输入标题">
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">简介</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input newsName"  value="{$t.desc1}" name="desc1" placeholder="产品简介120字以内">
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">排序</label>
		<div class="layui-input-inline">
			<input type="text" class="layui-input newsName"  value="{$t.sort}" name="sort" placeholder="数字越大越靠前">
		</div>
	</div>




	<div class="layui-form-item">


		<div class="layui-inline">
			<label class="layui-form-label">秒杀价</label>
			<div class="layui-input-inline">
				<input type="text" name="price" value="{$t.price}" class="layui-input newsAuthor" lay-verify="required" placeholder="请输入秒杀价">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">原价</label>
			<div class="layui-input-inline">
				<input type="text" name="oldprice" value="{$t.oldprice}" class="layui-input newsAuthor" lay-verify="required" placeholder="请输入原价">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">商品数量</label>
			<div class="layui-input-inline">
				<input type="text" name="num" value="{$t.num}" class="layui-input newsAuthor" lay-verify="required" placeholder="请输入商品数量">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">开抢时间</label>
			<div class="layui-input-inline">
				<input type="text" id="ks"  value="{:date('Y-m-d H:i:s',$t['starttime'])}" lay-verify="required" name="starttime" class="layui-input newsTime" >
			</div>
		</div>

		<div class="layui-inline">
			<label class="layui-form-label">结束时间</label>
			<div class="layui-input-inline">
				<input type="text" id="jz" value="{:date('Y-m-d H:i:s',$t['overtime'])}" lay-verify="required" name="overtime"  class="layui-input newsTime" >
			</div>
		</div>

	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">缩略图</label>
		<div class="layui-input-block">

			{empty name="t.pic"}
			<img src="{:_STATIC}/img/nopic.jpg" width="300" id="pic" />
			{else /}
			<img src="{:config('cdn')}/{$t.pic}" width="300" id="pic" />

			{/empty}

		</div>

		<input type="hidden" value="{$t.pic}" name="pic" id="picval" />
		<input type="hidden" name="tid" value="{:input('id')}" />

	</div>




	<div class="layui-form-item">
		<label class="layui-form-label">产品详情</label>
		<div class="layui-input-block">
				<textarea name="desc" id="news_content" style="height: 600px">


					{$t.desc}
				</textarea>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-input-block">
			<button class="layui-btn" type="button"  lay-submit="" lay-filter="addNews" >立即提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
</form>
{:jq()}
{:layui()}
{:ue()}
<script type="text/javascript">
    var cdn="{:config('cdn')}";
	layui.upload.render({
        elem: '#pic'
        ,url: "{:url('api/upload/ftp')}"
        ,size: 500000 //限制文件大小，单位 KB
        ,done: function(res){
            $("#picval").val(res.url);
            $("#pic").attr('src',cdn+res.url);

        }
    });
    var ue = UE.getEditor('news_content',{

        height:700
    });

    layui.laydate.render({
        elem: '#ks'
        ,type: 'datetime'
    });

    layui.laydate.render({
        elem: '#jz'
        ,type: 'datetime'
    });





    layui.form.on('submit(addNews)', function(data){

       $.post("{:url('seckill')}",data.field,function(res){

           if(res.code==200){

               parent.layer.msg('保存成功',{shift:0},function(){


                   location.href="{:url('seckilllist')}";

			   });



		   }else{

               parent.layer.msg(res.msg);

		   }

	   });

        return false;
    });


</script>
</body>
</html>